<?php

namespace app\giftcard\controller;

use app\common\controller\PCBase;
use app\BaseController;//测试专用
use app\giftcard\logic\GiftcardLogic;
use think\facade\Db;
use Throwable;
use app\common\library\Upload;

class Giftcard extends PCBase
{


    public function initialize(): void
    {
        parent::initialize();
    }

    /**
     * index
     * @throws Throwable
     */
    public function index()
    {
        $params     = $this->request->post();
        $GiftcardLogic = new GiftcardLogic();
        return $GiftcardLogic->index($params);
    }

    
    /**
     * 添加
     * @throws Throwable
     */
    public function add()
    {
        $post = $this->request->post();
        $admin_id    = $this->getAdminId();
        $post['admin_id'] = $admin_id;
        $GiftcardlogLogic = new GiftcardLogic();
        $result = $GiftcardlogLogic->add($post);
        return $result;
    }

    /**
     * 回显
     * @throws Throwable
     */
    public function find($id = null)
    {
        $post = $this->request->post();
        $GiftcardlogLogic = new GiftcardLogic();
        $result = $GiftcardlogLogic->find($post);
        return $result;
    }
    /**
     * 编辑
     * @throws Throwable
     */
    public function edit()
    {
        $post = $this->request->post();
        $GiftcardlogLogic = new GiftcardLogic();
        $result = $GiftcardlogLogic->edit($post);
        return $result;
    }

    /**
     * export
     * @throws Throwable
     */
    public function export()
    {
        $params     = $this->request->post();
        $GiftcardLogic = new GiftcardLogic();
        return $GiftcardLogic->export($params);
    }

    /**
     * batch
     * @throws Throwable
     */
    public function batch()
    {
        $params     = $this->request->post();
        $GiftcardLogic = new GiftcardLogic();
        return $GiftcardLogic->batch($params);
    }
}
